package com.scau.yangsuiyu.estore.controller.seller.manageBasicInfo;

import com.scau.yangsuiyu.estore.dababases.entity.Seller;
import de.felixroske.jfxsupport.FXMLController;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

/**
 * @author suiyu_yang
 * @description Seller的个人信息管理界面Controller
 * @date 2019-06-05 20:16
 * @email suiyu_yang@163.com
 */
@FXMLController
public class ManageSellerInfo extends AnchorPane implements Initializable {
    private Seller seller;


    @FXML
    private AnchorPane sellerDetailPane;


    public ManageSellerInfo() {
        this.seller = new Seller();
        loadFXML();
    }

    public ManageSellerInfo(Seller seller) {
        this.seller = seller;
        loadFXML();
    }

    private void loadFXML() {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/view/seller/manageBasicInfo/ManageSellerInfo.fxml"));
        fxmlLoader.setRoot(this);
        fxmlLoader.setController(this);
        try {
            fxmlLoader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @Override
    public void initialize(URL location, ResourceBundle resources) {
        InfoMessageSeller infoMessageSeller = new InfoMessageSeller(seller);
        sellerDetailPane.getChildren().add(infoMessageSeller);
    }

    @FXML
    private void gotoSecurityManage() {
        sellerDetailPane.getChildren().clear();
        InfoSecuritySeller infoSecuritySeller = new InfoSecuritySeller(seller);
        sellerDetailPane.getChildren().add(infoSecuritySeller);

    }

    @FXML
    private void gotoSellerMessage() {
        sellerDetailPane.getChildren().clear();
        InfoMessageSeller infoMessageSeller = new InfoMessageSeller(seller);
        sellerDetailPane.getChildren().add(infoMessageSeller);
    }

}
